package com.netty.rpc.ProxyInhandler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * Created by XiongMM on 2017/11/23.
 */
public class RpcProxyHandler extends ChannelInboundHandlerAdapter {

    private Object response;

    //把结果给暴露出去
    public Object getResponse(){
        return response;
    }

    //读取服务方，返回的结果
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception{
        this.response = msg;
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        System.out.println("client exception is general ~");
    }
}
